//
//  WLHomeCircleView.swift
//  WalkerLove
//
//  Created by Z on 2020/4/25.
//  Copyright © 2020 Carlson. All rights reserved.
//

import UIKit

class WLHomeCircleView: UIView {

    var shaper: CAShapeLayer?
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        initSubview()
    }
    
    func initSubview() {
        shaper = CAShapeLayer()
        shaper?.lineWidth = 10
        shaper?.strokeColor = DeviceTool.ColorFromRGB(0xff0000).cgColor
        shaper?.fillColor = UIColor.clear.cgColor
        layer.addSublayer(shaper!)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        shaper?.frame = bounds
        let bezier = UIBezierPath(arcCenter: CGPoint(x: bounds.width/2.0, y: bounds.height/2.0), radius: bounds.width/2.0-5, startAngle: CGFloat(-M_PI_2), endAngle: CGFloat(M_PI_2*3), clockwise: true)
        shaper?.path = bezier.cgPath
    }

}
